home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows 95 API Bible
/
Windows 95 API Bible 3 Disc Set.iso
/
Win32 API Bible Book 1 of 3.iso
/
chapte23
/
ex3.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-19
|
2KB
|
45 lines
#include <genstub.c>
LRESULT CALLBACK WndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static int nCount = 0; // Count times atom is added.
switch (uMsg) // Process windows messages.
{
case WM_COMMAND: // Process menu items.
switch (wParam)
{
case IDM_TEST:
{
HDC hDC = GetDC( hWnd );
ATOM atom = GlobalFindAtom( "Test String" );
if (atom)
TextOut( hDC, 0, 0, "Test String Found. ", 18 );
else
TextOut( hDC, 0, 0, "Test String Not Found.", 22 );
GlobalAddAtom( "Test String" );
nCount++;
ReleaseDC( hWnd, hDC );
}
break;
case IDM_EXIT:
DestroyWindow (hWnd) ;
break;
}
break;
case WM_DESTROY:
{
int i;
ATOM atom = GlobalFindAtom( "Test String" );
for (i = 0 ; i < nCount ; i++)
GlobalDeleteAtom( atom );
PostQuitMessage( 0 );
}
break;
default:
return DefWindowProc( hWnd, uMsg, wParam, lParam );
}
return( 0L );
}
#include <about.c>